package 种花605;

/**
 * ToDo
 *
 * @author: liuzhixin
 * @date: 2021/5/8,8:30
 * @project_name:LeetCode
 */
public class DD {
    public static boolean canPlaceFlowers(int[] flowerbed, int n) {
        for (int i =0; i<flowerbed.length; i+=2)
        {
            if(flowerbed[i]==0)
            {
                if(i==flowerbed.length-1 || flowerbed[i+1]==0)
                    n--;
                else
                    i++;
            }
        }
        return n<=0;
    }
    public static void main(String[] args) {
        int [] a = {0,0,0,0,0};
        boolean b = canPlaceFlowers(a, 4);
        System.out.println(b);
    }
}
